package com.geo.smallcredit.adapter;

import java.util.List;

import com.geo.smallcredit.R;
import com.geo.smallcredit.vo.BankVo;
import com.geo.smallcredit.vo.BankVo.DataVo;

import android.content.Context;
import android.text.Editable;
import android.text.Selection;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class MyBankAdapter extends BaseAdapter {
	private Context context;
	private Helper h;
	private List<DataVo> list;

	public MyBankAdapter(Context context, List<DataVo> list) {
		super();
		this.context = context;
		this.list = list;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int arg0) {
		return list.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return 0;
	}

	@Override
	public View getView(int arg0, View v, ViewGroup arg2) {
		if (v == null) {
			v = LayoutInflater.from(context).inflate(
					R.layout.my_bank_item, null);
			h = new Helper();
	//		h.biaozhi=(TextView) v.findViewById(R.id.my_bank_item_biaozhi);
			h.banknum=(TextView) v.findViewById(R.id.my_bank_item_banknum);
			h.bankname=(TextView) v.findViewById(R.id.my_bank_item_banknamename);
			h.banktype=(TextView) v.findViewById(R.id.my_bank_item_banktype);
			v.setTag(h);
		}
		h = (Helper) v.getTag();
	//	h.biaozhi.setText(list.get(arg0).getBank_shortname());
		h.banknum.setText((list.get(arg0).getBank_card_number().substring(0, 4)+"\t****\t****\t"+list.get(arg0).getBank_card_number().substring(15, 19)));
		h.bankname.setText(list.get(arg0).getBankname());
		h.banktype.setText(list.get(arg0).getCard_type());
		return v;
	}
	class Helper {
		TextView banknum,bankname,banktype;
	}
}
